class MalformedRequest extends Error {
  constructor (message) {
    super(message);
    this.name = 'MalformedRequest';
  }
}

class InvalidPDFSignatureError extends Error {
  constructor (message) {
    super(message);
    this.name = 'InvalidPDFSignatureError';
  }
}

class UploadPdfError extends Error {
  constructor (message) {
    super(message);
    this.name = 'UploadPdfError';
  }
}

class StateMachineExecutionError extends Error {
  constructor (message) {
    super(message);
    this.name = 'StateMachineExecutionError';
  }
}

class SetStatusError extends Error {
  constructor (message) {
    super(message);
    this.name = 'SetStatusError';
  }
}

class IngestApplicationError extends Error {
  constructor (message) {
    super(message);
    this.name = 'IngestApplicationError';
  }
}

function formatErrorForJson (error) {
  return { 'name': error.name, 'message': error.message };
}

module.exports = {
  MalformedRequest,
  InvalidPDFSignatureError,
  UploadPdfError,
  StateMachineExecutionError,
  SetStatusError,
  IngestApplicationError,
  formatErrorForJson
};
